import sun.font.TrueTypeFont;
import java.util.Random;
import java.util.Scanner;

public class 猜数字游戏 {
    public static void main(String[] args) {
        Random r = new Random();
        int number = r.nextInt(101);

        Scanner s = new Scanner(System.in);
        System.out.println("游戏开始了！\n有一个在0-100之间的数字，请把它找出来\n请输入：");
        while (true){
            int guessnumber = s.nextInt();
            if (guessnumber == number){
                System.out.println("恭喜你猜对了！！！");
                try{
                    Thread.sleep(2*1000);
                }catch(Exception e){
                    //System.exit(0);//退出程序
                }
             break;
            }else if (guessnumber > number){
                System.out.println("很遗憾，猜得大了一点，再试试吧！");
            }else if (guessnumber < number){
                System.out.println("很遗憾，猜得小了一点，再试试吧！");
            }else {
                System.out.println("出现了未知的错误！");
            }
        }
    }
}
